<?php

namespace App\Enums;

use App\Traits\EnumMethods;

enum FontFamily: string
{
    use EnumMethods;

    case HEAVY = 'heavy';
    case BOLD = 'bold';
    case EXTRA_LIGHT = 'extra_light';
    case LIGHT = 'light';
    case MEDIUM = 'medium';
    case NORMAL = 'normal';
    case REGULAR = 'regular';

    const FAMILY_MAP = [
        self::HEAVY->value => '重磅',
        self::BOLD->value => '加粗',
        self::MEDIUM->value => '中等',
        self::REGULAR->value => '普通',
        self::NORMAL->value => '标准',
        self::LIGHT->value => '细',
        self::EXTRA_LIGHT->value => '极细',
    ];

    const ASSETS_MAP = [
        self::BOLD->value => 'fonts/SourceHanSansCN-Bold.otf',
        self::EXTRA_LIGHT->value => 'fonts/SourceHanSansCN-ExtraLight.otf',
        self::HEAVY->value => 'fonts/SourceHanSansCN-Heavy.otf',
        self::LIGHT->value => 'fonts/SourceHanSansCN-Light.otf',
        self::MEDIUM->value => 'fonts/SourceHanSansCN-Medium.otf',
        self::NORMAL->value => 'fonts/SourceHanSansCN-Normal.otf',
        self::REGULAR->value => 'fonts/SourceHanSansCN-Regular.otf',
    ];

    public function toString(): string
    {
        return self::FAMILY_MAP[$this->value];
    }

    public function toAsset(): string
    {
        return resource_path(self::ASSETS_MAP[$this->value]);
    }
}
